package com.emotionalEnvelope.edu.controller;

import com.emotionalEnvelope.edu.core.RestResponse;
import com.emotionalEnvelope.edu.dto.UserinfoDto;
import com.emotionalEnvelope.edu.param.UserInFoParam;
import com.emotionalEnvelope.edu.service.IUserInFoService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/info")
public class UserInFoController {
    @Resource
    private IUserInFoService iUserInFoService;

    @GetMapping("/detail")
    public RestResponse<UserinfoDto> getUserinfo(@Validated @RequestParam Long id) {
        return iUserInFoService.getUserInfo(id);
    }

    @GetMapping("/delete")
    public RestResponse<String> delete(@Validated @RequestParam Long id) {
        return iUserInFoService.del(id);
    }

    @PostMapping("/save")
    public RestResponse<String> save(@Validated @RequestBody UserInFoParam userinfo) {
        return iUserInFoService.save(userinfo);
    }
}
